home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / himetr1r / frmfind.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-08-14  |  11.4 KB  |  328 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  3. Begin VB.Form frmFind 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Find"
  6.    ClientHeight    =   3150
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   4530
  10.    BeginProperty Font 
  11.       Name            =   "Tahoma"
  12.       Size            =   8.25
  13.       Charset         =   0
  14.       Weight          =   400
  15.       Underline       =   0   'False
  16.       Italic          =   0   'False
  17.       Strikethrough   =   0   'False
  18.    EndProperty
  19.    Icon            =   "frmFind.frx":0000
  20.    LinkTopic       =   "Form1"
  21.    MaxButton       =   0   'False
  22.    MinButton       =   0   'False
  23.    ScaleHeight     =   3150
  24.    ScaleWidth      =   4530
  25.    ShowInTaskbar   =   0   'False
  26.    StartUpPosition =   3  'Windows Default
  27.    Begin VB.PictureBox picTabContainer 
  28.       Height          =   2055
  29.       Index           =   3
  30.       Left            =   600
  31.       ScaleHeight     =   1995
  32.       ScaleWidth      =   3435
  33.       TabIndex        =   14
  34.       Top             =   3960
  35.       Width           =   3495
  36.       Begin VB.Frame fraCode 
  37.          Caption         =   "Search Code:"
  38.          Height          =   1575
  39.          Left            =   120
  40.          TabIndex        =   15
  41.          Top             =   120
  42.          Width           =   3255
  43.          Begin VB.CheckBox chkCase 
  44.             Caption         =   "&Case Sensitive"
  45.             Height          =   255
  46.             Index           =   1
  47.             Left            =   120
  48.             TabIndex        =   18
  49.             Top             =   1080
  50.             Width           =   2175
  51.          End
  52.          Begin VB.CheckBox chkMatchComplete 
  53.             Caption         =   "Match Complete String"
  54.             Height          =   255
  55.             Index           =   1
  56.             Left            =   120
  57.             TabIndex        =   17
  58.             Top             =   720
  59.             Width           =   2295
  60.          End
  61.          Begin VB.TextBox txtCode 
  62.             Height          =   285
  63.             Left            =   120
  64.             TabIndex        =   16
  65.             Top             =   360
  66.             Width           =   1935
  67.          End
  68.       End
  69.    End
  70.    Begin VB.PictureBox picTabContainer 
  71.       Height          =   2055
  72.       Index           =   2
  73.       Left            =   360
  74.       ScaleHeight     =   1995
  75.       ScaleWidth      =   3435
  76.       TabIndex        =   9
  77.       Top             =   3720
  78.       Width           =   3495
  79.       Begin VB.Frame fraNotes 
  80.          Caption         =   "Search Notes:"
  81.          Height          =   1575
  82.          Left            =   120
  83.          TabIndex        =   10
  84.          Top             =   120
  85.          Width           =   3255
  86.          Begin VB.CheckBox chkCase 
  87.             Caption         =   "&Case Sensitive"
  88.             Height          =   255
  89.             Index           =   0
  90.             Left            =   120
  91.             TabIndex        =   13
  92.             Top             =   1080
  93.             Width           =   2415
  94.          End
  95.          Begin VB.CheckBox chkMatchComplete 
  96.             Caption         =   "Match Complete String"
  97.             Height          =   255
  98.             Index           =   0
  99.             Left            =   120
  100.             TabIndex        =   12
  101.             Top             =   720
  102.             Width           =   2655
  103.          End
  104.          Begin VB.TextBox txtNotes 
  105.             Height          =   285
  106.             Left            =   120
  107.             TabIndex        =   11
  108.             Top             =   360
  109.             Width           =   1935
  110.          End
  111.       End
  112.    End
  113.    Begin VB.PictureBox picTabContainer 
  114.       Height          =   2055
  115.       Index           =   1
  116.       Left            =   240
  117.       ScaleHeight     =   1995
  118.       ScaleWidth      =   3435
  119.       TabIndex        =   3
  120.       Top             =   3480
  121.       Width           =   3495
  122.       Begin VB.Frame fraItems 
  123.          Caption         =   "Search Items:"
  124.          Height          =   1695
  125.          Left            =   120
  126.          TabIndex        =   4
  127.          Top             =   120
  128.          Width           =   3255
  129.          Begin VB.CheckBox chkMatch 
  130.             Caption         =   "Match Complete String"
  131.             Height          =   255
  132.             Left            =   120
  133.             TabIndex        =   8
  134.             Top             =   1200
  135.             Width           =   1935
  136.          End
  137.          Begin VB.OptionButton optEntire 
  138.             Caption         =   "Search entire tree"
  139.             Height          =   255
  140.             Left            =   120
  141.             TabIndex        =   7
  142.             Top             =   960
  143.             Width           =   2295
  144.          End
  145.          Begin VB.OptionButton optBranch 
  146.             Caption         =   "Search selected branch only"
  147.             Height          =   195
  148.             Left            =   120
  149.             TabIndex        =   6
  150.             Top             =   720
  151.             Width           =   3015
  152.          End
  153.          Begin VB.TextBox txtItems 
  154.             Height          =   285
  155.             Left            =   120
  156.             TabIndex        =   5
  157.             Top             =   360
  158.             Width           =   1935
  159.          End
  160.       End
  161.    End
  162.    Begin VB.CommandButton cmdCancel 
  163.       Caption         =   "&Cancel"
  164.       Height          =   375
  165.       Left            =   3360
  166.       TabIndex        =   2
  167.       Top             =   2640
  168.       Width           =   1095
  169.    End
  170.    Begin VB.CommandButton cmdFind 
  171.       Caption         =   "&Find"
  172.       Default         =   -1  'True
  173.       Height          =   375
  174.       Left            =   2160
  175.       TabIndex        =   1
  176.       Top             =   2640
  177.       Width           =   1095
  178.    End
  179.    Begin ComctlLib.TabStrip tbsTab 
  180.       Height          =   2415
  181.       Left            =   120
  182.       TabIndex        =   0
  183.       Top             =   120
  184.       Width           =   4335
  185.       _ExtentX        =   7646
  186.       _ExtentY        =   4260
  187.       _Version        =   327682
  188.       BeginProperty Tabs {0713E432-850A-101B-AFC0-4210102A8DA7} 
  189.          NumTabs         =   3
  190.          BeginProperty Tab1 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  191.             Caption         =   "Search &Items"
  192.             Key             =   ""
  193.             Object.Tag             =   ""
  194.             Object.ToolTipText     =   "Seach Items"
  195.             ImageVarType    =   2
  196.          EndProperty
  197.          BeginProperty Tab2 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  198.             Caption         =   "Search &Notes"
  199.             Key             =   ""
  200.             Object.Tag             =   ""
  201.             Object.ToolTipText     =   "Search Notes"
  202.             ImageVarType    =   2
  203.          EndProperty
  204.          BeginProperty Tab3 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  205.             Caption         =   "Search &Code"
  206.             Key             =   ""
  207.             Object.Tag             =   ""
  208.             Object.ToolTipText     =   "Search Code"
  209.             ImageVarType    =   2
  210.          EndProperty
  211.       EndProperty
  212.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  213.          Name            =   "Tahoma"
  214.          Size            =   8.25
  215.          Charset         =   0
  216.          Weight          =   400
  217.          Underline       =   0   'False
  218.          Italic          =   0   'False
  219.          Strikethrough   =   0   'False
  220.       EndProperty
  221.    End
  222. Attribute VB_Name = "frmFind"
  223. Attribute VB_GlobalNameSpace = False
  224. Attribute VB_Creatable = False
  225. Attribute VB_PredeclaredId = True
  226. Attribute VB_Exposed = False
  227. '----------------------------------------
  228. '- Name: Sam Huggill
  229. '- Email: sam@vbsquare.com
  230. '- Web: http://www.vbsquare.com/
  231. '- Company: Lighthouse Internet Solutions
  232. '- Date/Time: 14/08/99 11:32:26
  233. '----------------------------------------
  234. '- Notes:   Find dialog
  235. '----------------------------------------
  236. Option Explicit
  237. '// Holds a reference to the number of tabs
  238. Private Const NumberOfTabs = 3
  239. Private Sub cmdCancel_Click()
  240.     Unload Me
  241. End Sub
  242. Private Sub cmdFind_Click()
  243.     '// Determine what the user is doing
  244.     Select Case tbsTab.SelectedItem.Index
  245.         Case 1 'Items
  246.             FindItem txtItems, frmMain.tvwItems
  247.         Case 2 'Notes
  248.             modData.Key = frmMain.tvwItems.SelectedItem.Key
  249.             If modData.FindNotes(txtNotes, frmMain.ctlFavourites1, frmMain.tvwItems) Then Unload Me
  250.         Case 3 'Code
  251.             FindCode txtCode, frmMain.tvwItems, frmMain.ctlData1
  252.         Case Else
  253.     End Select
  254. End Sub
  255. Private Sub Form_Load()
  256.     Dim intX As Integer
  257.     Dim blnTab As Boolean
  258.     Dim intTabIndex As Integer
  259.     For intX = 1 To NumberOfTabs
  260.         With picTabContainer(intX)
  261.             .BorderStyle = 0
  262.             .left = tbsTab.ClientLeft
  263.             .tOp = tbsTab.ClientTop
  264.             .Width = tbsTab.ClientWidth
  265.             .Height = tbsTab.ClientHeight
  266.             .Visible = False
  267.         End With
  268.     Next intX
  269.     '// Should we show the last used tab?
  270.     blnTab = GetSetting(ThisApp, "General", "Remember Tabs", True)
  271.     If blnTab = True Then
  272.         intTabIndex = Val(GetSetting(ThisApp, "General", "Find", 1))
  273.         'Line Added by Peter L Henry
  274.         If intTabIndex = 0 Then intTabIndex = 1
  275.         tbsTab.Tabs(intTabIndex).Selected = True
  276.     End If
  277.     CentreForm Me
  278.     '// Move the frames
  279.     fraCode.Move ScaleLeft + 15, ScaleTop + 15, ScaleWidth - 15, ScaleHeight - 15
  280.     fraItems.Move ScaleLeft + 15, ScaleTop + 15, ScaleWidth - 15, ScaleHeight - 15
  281.     fraNotes.Move ScaleLeft + 15, ScaleTop + 15, ScaleWidth - 15, ScaleHeight - 15
  282.     optEntire.Value = True
  283. End Sub
  284. Private Sub Form_Unload(Cancel As Integer)
  285.     Dim intTabIndex As Integer
  286.     Dim blnTab As Boolean
  287.     '// Save the current tab
  288.     blnTab = GetSetting(ThisApp, "General", "Remember Tabs", True)
  289.     If blnTab = True Then
  290.         SaveSetting ThisApp, "General", "Find", tbsTab.SelectedItem.Index
  291.     End If
  292. End Sub
  293. Private Sub tbsTab_Click()
  294.     Static PrevTab As Integer
  295.     PrevTab = Switch(PrevTab = 0, 1, PrevTab >= 1 And PrevTab <= NumberOfTabs, PrevTab)
  296.     picTabContainer(PrevTab).Visible = False
  297.     picTabContainer(tbsTab.SelectedItem.Index).Visible = True
  298.     picTabContainer(tbsTab.SelectedItem.Index).Refresh
  299.     PrevTab = tbsTab.SelectedItem.Index
  300.     DoEvents
  301. End Sub
  302. Public Sub FindItem(sText As String, tvw As TreeView)
  303.     '// Seach the current branch: Only supports one level
  304.     If optBranch = True Then
  305.         If tvw.SelectedItem.Children = 0 Then
  306.             MsgBox "The selected item has no children.", vbOKOnly + vbInformation
  307.             Unload Me
  308.         End If
  309.         '// Set the key and find
  310.         modData.Key = tvw.SelectedItem.Key
  311.         If modData.FindBranch(tvw, txtItems, frmMain.ctlFavourites1, chkMatch.Value) Then
  312.             Unload Me
  313.         End If
  314.     End If
  315.     If optEntire = True Then 'Search entire tree
  316.         If chkMatch.Value Then
  317.             If modData.FindWhole(sText, frmMain.ctlFavourites1, frmMain.tvwItems) Then Unload Me
  318.         Else
  319.             If modData.FindPartX(sText, frmMain.ctlFavourites1, frmMain.tvwItems) Then Unload Me
  320.         End If
  321.     End If
  322. End Sub
  323. Sub FindCode(sText As String, tvw As TreeView, ctl As Object)
  324.     If ctl.Find(sText) Then 'Found a match
  325.         Unload Me
  326.     End If
  327. End Sub
  328.